{extend name="Base/base"/}

{block name="body"}
<!-- 标题 -->
<div class="main-title">
    <h2>
        已领取优惠券                    </h2>
</div>

<div style="margin-bottom: 10px;" class="hide" id="search_form">

    <style>
        .tb_search td{
            padding: 5px 10px;
        }
    </style>
    <form id="searchForm" method="get" action="/uctoo/admin.php?s=/shop/user_coupon.html" class="form-dont-clear-url-param">
        <div class="search-form  cf " style="margin-bottom: 10px">
            <table class="tb_search">

                <tbody><tr><td></td>
                    <td><input type="submit" class="btn" value="确定"> <button class="btn ajax-post btn" onclick="toggle_search()">关闭</button></td>
                    <td></td>
                </tr>
                </tbody></table>
        </div>
    </form>
    <div style="border-top:1px solid #ccc;border-bottom: 1px solid white"></div>
</div>
<!-- 按钮工具栏 -->
<div class="with-padding">
    <div class="fl">

        <a href="/uctoo/admin.php?s=/shop/user_coupon/action/add.html" class="btn btn-ajax btn-success btn">派发优惠券</a>&nbsp;<button class="btn ajax-post btn" url="/uctoo/admin.php?s=/shop/user_coupon/action/delete.html&amp;" target-form="ids">删除</button>&nbsp;

        <!-- 选择框select -->
        <div style="float: right;">
            <style>
                .oneselect{
                    display: inline-block;
                    margin-left: 10px;
                }
                .oneselect .title{
                    float: left;
                    line-height: 32px;
                }
                .oneselect .select_box{
                    float: left;
                    line-height: 32px;
                }
                .oneselect .select_box select{
                    min-width: 200px;
                }
            </style>
            <form id="selectForm" method="get" action="/uctoo/admin.php?s=/shop/user_coupon.html" class="form-dont-clear-url-param">
            </form>
        </div>
    </div>

</div>


<!-- 数据表格 -->
<div class="with-padding" stype="width:auto; overflow: auto;">
    <table id="table-data" class="table table-bordered table-striped table-hover">
        <!-- 表头 -->
        <thead>
        <tr>
            <th class="row-selected row-selected" style="width: 20px">
                <input class="check-all" type="checkbox">
            </th>
            <th>ID</th><th>用户id</th><th>优惠券</th><th>优惠券图片</th><th>折扣,单位:分</th><th>满多少可用,单位:分</th><th>发放时间</th><th>到期时间</th><th>订单号（无）</th><th>状态</th>            </tr>
        </thead>

        <!-- 列表 -->
        <tbody>
        </tbody>
    </table>
</div>
<!-- 分页 -->
<div class="with-padding">
</div>
</div>
{/block}

{block name="script"}
<script type="text/javascript">
    $(function () {
        //搜索功能
        $("#search").click(function () {
            var url = $(this).attr('url');
            var query = $('.search-form').find('input').serialize();
            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
            query = query.replace(/^&/g, '');
            if (url.indexOf('?') > 0) {
                url += '&' + query;
            } else {
                url += '?' + query;
            }
            window.location.href = url;
        });
        //回车搜索
        $(".search-input").keyup(function (e) {
            if (e.keyCode === 13) {
                $("#search").click();
                return false;
            }
        });
        //导航高亮

        //点击排序
        $('.list_sort').click(function () {
            var url = $(this).attr('url');
            var ids = $('.ids:checked');
            var param = '';
            if (ids.length > 0) {
                var str = new Array();
                ids.each(function () {
                    str.push($(this).val());
                });
                param = str.join(',');
            }

            if (url != undefined && url != '') {
                window.location.href = url + '/ids/' + param;
            }
        });
    });
</script>
{/block}